#!/usr/bin/env bash -e

# Note: use lowercase names for the Docker images
DOCKER_IMAGE="icuboid/sensewire/server-nginx"

APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"

build_docker() {
    DOCKER_LABEL2="Commit=$(git log --pretty=format:'%H' -n 1)"
    DOCKER_LABEL3="Date=$(/usr/bin/env date +%Y-%m-%dT%H:%M:%S)"

    cd $APP_HOME

    echo "Running docker command"
    docker build --compress --tag "$DOCKER_IMAGE:testing" \
      --label "$DOCKER_LABEL2" --label "$DOCKER_LABEL3" .
}

build_docker